﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.ServiceModel;
using System.Text;

namespace nwrole.lib {
    [ServiceBehavior(InstanceContextMode = InstanceContextMode.Single, ConcurrencyMode = ConcurrencyMode.Reentrant)]
    public class OrchestratorCtrlService : IOrchestratorCtrlContract {

        private OrchestratorService orchestratorService;

        public OrchestratorCtrlService(OrchestratorService orchestratorService) {
            this.orchestratorService = orchestratorService;
        }

        public void Stop() {
            
        }

        public int GetNumSupervisors() {
            return orchestratorService.NumConnectedSupervisors;
        }

        public SupervisorInfo[] GetRegisteredSupervisors()
        {
            return orchestratorService.GetRegisteredSupervisors();
        }

        public SupervisorData[] GetSupervisors() {
            return orchestratorService.GetSupervisors();
        }

        /*public Result StartSupervisor(Guid supervisorId)
        {
            return orchestratorService.StartSupervisor(supervisorId);
        }

        public Result StopSupervisor(Guid supervisorId)
        {
            return orchestratorService.StopSupervisor(supervisorId);
        }*/

        public Result RestartSupervisor(Guid supervisorId)
        {
            return orchestratorService.RestartSupervisor(supervisorId);
        }

        public Result RestartService(Guid serviceId)
        {
            return orchestratorService.RestartService(serviceId);
        }

        public Result StopService(Guid serviceId)
        {
            return orchestratorService.StopService(serviceId);
        }

        public Result StartService(Guid serviceId)
        {
            return orchestratorService.StartService(serviceId);
        }

        public ServiceInfo[] GetSupervisorServicesInfo(Guid supervisorId) {
            return orchestratorService.GetSupervisorServicesInfo(supervisorId);
        }

        public ServiceInfo GetServiceInfo(Guid serviceId)
        {
            return orchestratorService.GetServiceInfo(serviceId);
        }

        public PluginInfo[] GetServicePluginsInfo(Guid serviceId)
        {
            return orchestratorService.GetServicePluginsInfo(serviceId);
        }

        public LogMessage[] GetLogForObject(Guid objectId)
        {
            return orchestratorService.GetLogForObject(objectId);
        }
    }
}
